package java_thinking.unit_17._17_9_10;

import java.util.*;

/**
 * @Desc:   直接将生成的容器传递给适当的同步方法，这样做就不会有任何机会暴露出不同步的版本
 * @author: cww
 * @DateTime: 2019-04-21 16:13
 */

public class Synchronization {
    public static void main(String[] args) {
        Collection<String> c = Collections.synchronizedCollection(new ArrayList<>());
        List<String> list = Collections.synchronizedList(new ArrayList<>());
        Set<String> set = Collections.synchronizedSet(new HashSet<>());
        Set<String> set2 = Collections.synchronizedSet(new TreeSet<>());
        Map<String,String> map = Collections.synchronizedMap(new HashMap<>());
        Map<String,String> map2 = Collections.synchronizedMap(new TreeMap<>());

    }
}
